package com.runtu.test.types.rule02.factory;

import com.runtu.test.types.rule02.logic.RuleLogic201;
import com.runtu.test.types.rule02.logic.RuleLogic202;
import com.runtu.test.types.rule02.logic.XxxResponse;
import com.runtu.types.design.framework.link.model2.LinkArmory;
import com.runtu.types.design.framework.link.model2.chain.BusinessLinkedList;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Service;

/**
 * @ClassName Rule02TradeRuleFactory
 * @Description TODO
 * @date 2025/8/7 16:53
 * @Version 1.0
 */
@Service
public class Rule02TradeRuleFactory {

    /*demo01和demo02 填充 互不打扰 因为多实例链路 会给每次填充实例化一个对象 他们互不打扰 分别执行*/
    //解耦开之后 再通过LinkArmory自动装配来进行操作
    @Bean("demo01")
    public BusinessLinkedList<String, DynamicContext, XxxResponse> demo01(RuleLogic201 ruleLogic201, RuleLogic202 ruleLogic202) {
        LinkArmory<String, DynamicContext, XxxResponse> linkArmory = new LinkArmory<>("demo01", ruleLogic201, ruleLogic202);
        return linkArmory.getLogicLink();
    }

    @Bean("demo02")
    public BusinessLinkedList<String, DynamicContext, XxxResponse> demo02(RuleLogic202 ruleLogic202) {
        LinkArmory<String, DynamicContext, XxxResponse> linkArmory = new LinkArmory<>("demo02", ruleLogic202);
        return linkArmory.getLogicLink();
    }

    @Data
    @Builder
    @AllArgsConstructor
    @NoArgsConstructor
    public static class DynamicContext {
        private String age;
    }


}
